package com.vq3.digitalizationsoftwareintegrates.Service.Spot_Check.Impl;

import com.baomidou.mybatisplus.core.conditions.query.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vq3.digitalizationsoftwareintegrates.Entity.Enum.Group_Type;
import com.vq3.digitalizationsoftwareintegrates.Entity.Enum.S_CType;
import com.vq3.digitalizationsoftwareintegrates.Entity.Enum.StatusType;
import com.vq3.digitalizationsoftwareintegrates.Entity.Info.ResultInfo;
import com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.*;
import com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.MongoDBEntity.MongoDB_S_C_Point_ContentEntity;
import com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.MongoDBEntity.MongoDB_S_C_SaveSCDailyContextEntity;
import com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.MongoDBEntity.MongoDB_S_C_WebSocketMessageEntity;
import com.vq3.digitalizationsoftwareintegrates.Entity.User.Permission_TBEntity;
import com.vq3.digitalizationsoftwareintegrates.Entity.User.URole_TBEntity;
import com.vq3.digitalizationsoftwareintegrates.Entity.User.UserEntity;
import com.vq3.digitalizationsoftwareintegrates.Mapper.Spot_Check.*;
import com.vq3.digitalizationsoftwareintegrates.Mapper.User.URole_TBMapper;
import com.vq3.digitalizationsoftwareintegrates.MongoDB.Spot_Check.Impl.MongoDB_S_C_Point_ContentDaoImpl;
import com.vq3.digitalizationsoftwareintegrates.MongoDB.Spot_Check.MongoDB_S_C_Point_ContentDao;
import com.vq3.digitalizationsoftwareintegrates.MongoDB.Spot_Check.MongoDB_S_C_SaveDailyContextDao;
import com.vq3.digitalizationsoftwareintegrates.Service.Spot_Check.Spot_Check_FusionService;
import com.vq3.digitalizationsoftwareintegrates.Utils.DateUtils.GetServerDate;
import com.vq3.digitalizationsoftwareintegrates.Utils.GetYAML;
import com.vq3.digitalizationsoftwareintegrates.Utils.ImageUtil.CalculationIsNull;
import com.vq3.digitalizationsoftwareintegrates.Utils.ImageUtil.OnOrDownLoadImage;
import org.jetbrains.annotations.NotNull;
import org.springframework.context.annotation.Import;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 被这个模块绕晕了          -0- -0-
 *                           ^
 * */
@Service
@Import({S_C_PointEntity.class, MongoDB_S_C_Point_ContentDaoImpl.class})
public class Spot_Check_FusionServiceImpl implements Spot_Check_FusionService {
    /**注解注入，方便
     * */
    @Resource
    GetYAML getYAML;
    @Resource
    S_C_StatusMapper s_c_statusMapper;
    @Resource
    MongoDB_S_C_SaveDailyContextDao mongoDB_s_c_saveDailyContextDao;



    /**使用构造器注入，可靠性好
     *
     * */
    final URole_TBMapper uRole_tbMapper;
    final S_C_DatesMapper s_c_datesMapper;
    final Group_TBMapper _group_tbMapper;
    final S_C_Point_ContentMapper s_c_point_contentMapper;
    final S_C_PointMapper s_c_pointMapper;
    final S_C_StatusMapper statusMapper;
    final S_C_PointEntity s_c_pointEntity;
    final MongoDB_S_C_Point_ContentDao mongoDB_s_c_point_contentDao;

    public Spot_Check_FusionServiceImpl(URole_TBMapper uRole_tbMapper, S_C_DatesMapper s_c_datesMapper,
                                        Group_TBMapper _group_tbMapper,
                                        S_C_Point_ContentMapper s_c_point_contentMapper,
                                        S_C_PointMapper s_c_pointMapper,
                                        S_C_StatusMapper statusMapper,
                                        S_C_PointEntity s_c_pointEntity,
                                        MongoDB_S_C_Point_ContentDao mongoDB_s_c_point_contentDao) {
        this.uRole_tbMapper = uRole_tbMapper;
        this.s_c_datesMapper = s_c_datesMapper;
        this._group_tbMapper = _group_tbMapper;
        this.s_c_point_contentMapper = s_c_point_contentMapper;
        this.s_c_pointMapper = s_c_pointMapper;
        this.statusMapper = statusMapper;
        this.s_c_pointEntity = s_c_pointEntity;
        this.mongoDB_s_c_point_contentDao = mongoDB_s_c_point_contentDao;
    }
    public ResultInfo addPointName(String post_check_Point_Name) {
        ResultInfo resultInfo = new ResultInfo();
        QueryWrapper<S_C_PointEntity>  queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("point_name", post_check_Point_Name);
        List<S_C_PointEntity> s_c_pointEntities = s_c_pointMapper.selectList(queryWrapper);

        if (s_c_pointEntities.size() > 0) {
            resultInfo.setFlag(false);
            resultInfo.setErrorMsg("该点位已存在！请检查");
        } else {
            List<MongoDB_S_C_Point_ContentEntity> one = mongoDB_s_c_point_contentDao.findOne(post_check_Point_Name);
            if (one.size() == 0) {
                resultInfo.setFlag(true);
                resultInfo.setErrorMsg("已验证！可添加！");
            }else {
                resultInfo.setFlag(false);
                for (MongoDB_S_C_Point_ContentEntity mongoDB_s_c_point_contentEntity : one) {
                    if (mongoDB_s_c_point_contentEntity.getS_C_Type() == S_CType.TEMP){
                        if (mongoDB_s_c_point_contentEntity.getStatus_Type() == StatusType.NotSubmitted){
                            resultInfo.setErrorMsg("当前点位已填写，未提交！");
                            resultInfo.setData(StatusType.NotSubmitted);
                        }else if (mongoDB_s_c_point_contentEntity.getStatus_Type() == StatusType.Submitted) {
                            resultInfo.setErrorMsg("当前点位已提交！未审核！");
                            resultInfo.setData(StatusType.Submitted);
                        }else if (mongoDB_s_c_point_contentEntity.getStatus_Type() == StatusType.ReviewNG) {
                            resultInfo.setErrorMsg("当前点位已提交，审核未通过");
                            resultInfo.setData(StatusType.ReviewNG);
                        }else if (mongoDB_s_c_point_contentEntity.getStatus_Type() == StatusType.obsolete) {
                            resultInfo.setErrorMsg("当前点位信息已过时！");
                            resultInfo.setData(StatusType.obsolete);
                        }else {
                            resultInfo.setErrorMsg("系统异常！请联系系统管理员！");
                        }
                    }else {
                        resultInfo.setErrorMsg("系统异常！请联系系统管理员！");
                    }
                }
            }

        }


        return resultInfo;
    }

    public ResultInfo checkIsNull(Map<String,List<String>> map) {
        ResultInfo resultInfo = new ResultInfo();
        List<String> a_row_col_inArrName = map.get("a_row_col_inArrName");
        List<String> funArr = map.get("funArr");
        List<String> benchmarkArr = map.get("benchmarkArr");
        ArrayList<String> ItemNameArrayList = new ArrayList<>();
        ArrayList<String> funArrList = new ArrayList<>();
        ArrayList<String> benchmarkArrList = new ArrayList<>();
        ArrayList<S_C_Point_ContentEntity> s_c_point_contentEntityArrayList = new ArrayList<>();


        for (int i = 0; i < a_row_col_inArrName.size(); i++) {
            if (!"".equalsIgnoreCase(a_row_col_inArrName.get(i)) && a_row_col_inArrName.get(i).length() != 0) {
                ItemNameArrayList.add(a_row_col_inArrName.get(i));
                try{
                    funArrList.add(funArr.get(i));
                    benchmarkArrList.add(benchmarkArr.get(i));
                }catch (Exception e){
                    e.printStackTrace();
                }

            }
        }

        for (int i = 1; i<= ItemNameArrayList.size();i++) {
            S_C_Point_ContentEntity s_c_point_contentEntity = new S_C_Point_ContentEntity();
            s_c_point_contentEntity.setPointContentId(i);
            s_c_point_contentEntity.setPointContent(ItemNameArrayList.get(i-1));
            s_c_point_contentEntity.setScFun(funArrList.get(i-1));
            s_c_point_contentEntity.setScBenchmark(benchmarkArrList.get(i-1));
            s_c_point_contentEntityArrayList.add(s_c_point_contentEntity);
        }
        resultInfo.setData(s_c_point_contentEntityArrayList);
        return resultInfo;
    }

    public ResultInfo loadImage(List<MultipartFile> files, List<String> thisNull, List<String> nameArr,List<String> funArr,List<String> benchmarkArr, HttpServletRequest httpServletRequest) throws IOException {
        CalculationIsNull calculationIsNull = new CalculationIsNull();
        OnOrDownLoadImage onOrDownLoadImage = new OnOrDownLoadImage(mongoDB_s_c_point_contentDao);
        ResultInfo resultInfo = new ResultInfo();




        List<S_C_Point_ContentEntity> s_c_point_contentEntities_f = new ArrayList<>();
        List<S_C_Point_ContentEntity> s_c_point_contentEntities = calculationIsNull.M_CalculationIsNull(thisNull, files, nameArr,funArr,benchmarkArr);


        for (int i = 0; i < s_c_point_contentEntities.size(); i++) {
            S_C_Point_ContentEntity s_c_point_contentEntity = new S_C_Point_ContentEntity();
            s_c_point_contentEntity.setPointContentId(i + 1);
            s_c_point_contentEntity.setPointContent(s_c_point_contentEntities.get(i).getPointContent());
            s_c_point_contentEntity.setScFun(s_c_point_contentEntities.get(i).getScFun());
            s_c_point_contentEntity.setScBenchmark(s_c_point_contentEntities.get(i).getScBenchmark());
            if (s_c_point_contentEntities.get(i).getPoint_Content_standardImage() != null){
                s_c_point_contentEntity.setPoint_Content_standardImage(s_c_point_contentEntities.get(i).getPoint_Content_standardImage());
            }
            s_c_point_contentEntity.setImgBytes(s_c_point_contentEntities.get(i).getImgBytes());

            s_c_point_contentEntities_f.add(s_c_point_contentEntity);
        }
        boolean flag = false;

        List<S_C_Point_ContentEntity> s_c_point_contentEntities1 = onOrDownLoadImage.tempOnLoadImage(s_c_point_contentEntities_f, getYAML.getTempImgPath(),httpServletRequest);
        for (S_C_Point_ContentEntity s_c_point_contentEntity : s_c_point_contentEntities1) {
            if (s_c_point_contentEntity.getImgBytes() != null) {
                flag = true;
                break;
            }
        }
        resultInfo.setFlag(flag);

        return resultInfo;
    }

    public List<S_C_Point_ContentEntity> downLoadImage(String pointName, UserEntity userEntity, S_CType sCType) throws IOException {
        List<MongoDB_S_C_Point_ContentEntity> tempImage = mongoDB_s_c_point_contentDao.findTempImage(pointName, userEntity, sCType);
        OnOrDownLoadImage onOrDownLoadImage = new OnOrDownLoadImage(mongoDB_s_c_point_contentDao);
        return onOrDownLoadImage.downLoadImage(tempImage);

    }

    public List<S_C_Point_ContentEntity> downLoadImage(String pointName, UserEntity userEntity, S_CType sCType, StatusType statusType) throws IOException {
        List<MongoDB_S_C_Point_ContentEntity> tempImage = mongoDB_s_c_point_contentDao.findTempImage(pointName, userEntity, sCType,statusType);
        OnOrDownLoadImage onOrDownLoadImage = new OnOrDownLoadImage(mongoDB_s_c_point_contentDao);
        return onOrDownLoadImage.downLoadImage(tempImage);

    }

    public void reviseItem(String pointName, UserEntity userEntity, S_CType sCType, StatusType statusType) {
        mongoDB_s_c_point_contentDao.reviseItem(pointName, userEntity, sCType, statusType);
    }

    public boolean check_ok_submit(String pointName, StatusType statusType, Group_Type group_type) {
        return mongoDB_s_c_point_contentDao.check_ok_submit(pointName, statusType,group_type);

    }

    public boolean saveWebSocketMessage_S_C_Audit(MongoDB_S_C_WebSocketMessageEntity messageEntity) {
        return mongoDB_s_c_point_contentDao.saveWebSocketMessage(messageEntity);
    }

    public List<URole_TBEntity> findURole_TBEntity_S_C_Audit() {
        QueryWrapper<URole_TBEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("urole","superuser").or().eq("urole","r4");
        return uRole_tbMapper.selectList(queryWrapper);
    }

    public List<MongoDB_S_C_WebSocketMessageEntity> findMongoDB_S_C_WebSocketMessageEntity(List<URole_TBEntity> uRole_tbEntityS){
        return mongoDB_s_c_point_contentDao.findMongoDB_S_C_WebSocketMessageEntity(uRole_tbEntityS);
    }

    @Override
    public List<MongoDB_S_C_WebSocketMessageEntity> findMongoDB_S_C_WebSocketMessageEntity(Permission_TBEntity permission_tbEntity) {
        return mongoDB_s_c_point_contentDao.findMongoDB_S_C_WebSocketMessageEntity(permission_tbEntity);
    }

    @Override
    public List<MongoDB_S_C_SaveSCDailyContextEntity> findMongoDB_S_C_SaveSCDailyContextEntity(Permission_TBEntity permission_tbEntity) {
        return mongoDB_s_c_saveDailyContextDao.findMongoDB_s_c_saveDailyContextEntity(permission_tbEntity);
    }

    public List<MongoDB_S_C_Point_ContentEntity> itemNameFindMongoDB_S_C_Point_ContentEntity(String itemName) {
        return mongoDB_s_c_point_contentDao.itemNameFindMongoDB_S_C_Point_ContentEntity(itemName);
    }

    public IPage<S_C_PointEntity> findAllPointTODataCenter(int page) {
        IPage<S_C_PointEntity> S_C_PointEntity = new Page<>(page,10);
        QueryWrapper<S_C_PointEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("DISTINCT point_name").eq("delete_status","1").lambda();
        queryWrapper.orderByDesc("createTime");

        IPage<com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.S_C_PointEntity> s_c_pointEntityIPage = s_c_pointMapper.selectPage(S_C_PointEntity, queryWrapper);
        List<com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.S_C_PointEntity> records = s_c_pointEntityIPage.getRecords();

        for (com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.S_C_PointEntity record : records) {
            String pointName = record.getPointName();
            QueryWrapper<S_C_PointEntity> s_c_pointEntityQueryWrapper = new QueryWrapper<>();
            s_c_pointEntityQueryWrapper.eq("point_name",pointName);
            List<com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.S_C_PointEntity> s_c_pointEntities = s_c_pointMapper.selectList(s_c_pointEntityQueryWrapper);
            QueryWrapper<S_C_PointEntity> queryWrapper1 = new QueryWrapper<>();
            queryWrapper1.eq("point_name",pointName).eq("point_content_id",1);
            List<com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.S_C_PointEntity> s_c_pointEntities1 = s_c_pointMapper.selectList(queryWrapper1);
            List<Integer> groupIdS = new ArrayList<>();
            for (com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.S_C_PointEntity sCPointEntity : s_c_pointEntities1) {
                groupIdS.add(sCPointEntity.getGroupId());
            }
            record.setGroupIdS(groupIdS);
            record.setPointCount(s_c_pointEntities.get(0).getPointCount());
            record.setUpdateTime(s_c_pointEntities.get(0).getUpdateTime());
            record.setCreateTime(s_c_pointEntities.get(0).getCreateTime());
            record.setGroupId(s_c_pointEntities.get(0).getGroupId());
        }


        return s_c_pointEntityIPage;
    }

    public List<S_C_Point_ContentEntity> findAllPointContentToDataCenter(String itemName) {
        QueryWrapper<S_C_Point_ContentEntity> s_c_point_contentEntityQueryWrapper = new QueryWrapper<>();
        s_c_point_contentEntityQueryWrapper.eq("point_name",itemName);
        return s_c_point_contentMapper.selectList(s_c_point_contentEntityQueryWrapper);
    }

    public List<S_C_PointEntity> groupIdFindPoint(int groupId) {
        QueryWrapper<S_C_PointEntity> s_c_pointEntityQueryWrapper = new QueryWrapper<>();
        s_c_pointEntityQueryWrapper.eq("group_id",groupId).eq("delete_status",1);
        return s_c_pointMapper.selectList(s_c_pointEntityQueryWrapper);
    }

    public List<S_C_DatesEntity> getS_CContext(String pointName, Date date) {
        QueryWrapper<S_C_DatesEntity> s_c_datesEntityQueryWrapper = new QueryWrapper<>();
        s_c_datesEntityQueryWrapper.eq("point",pointName).eq("date",date);
        return s_c_datesMapper.selectList(s_c_datesEntityQueryWrapper);
    }

    public List<S_C_Point_ContentEntity> getS_CContextItems(String pointName) {
        QueryWrapper<S_C_Point_ContentEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("point_name",pointName);
        return s_c_point_contentMapper.selectList(queryWrapper);
    }

    public void saveSCDailyContext (List<S_C_DatesEntity> s_c_datesEntities) {
        try {
            for (S_C_DatesEntity s_c_datesEntity : s_c_datesEntities) {
                QueryWrapper<S_C_DatesEntity> s_c_datesEntityQueryWrapper = new QueryWrapper<>();
                s_c_datesEntityQueryWrapper.eq("point",s_c_datesEntity.getPoint())
                        .eq("point_content",s_c_datesEntity.getPointContent())
                        .eq("date",s_c_datesEntity.getDate())
                        .eq("id",s_c_datesEntity.getId());
                int update = s_c_datesMapper.update(s_c_datesEntity, s_c_datesEntityQueryWrapper);

                System.out.println(update);
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
    }

   // conditionalQueries function rewrite Start
    public IPage<S_C_PointEntity> conditionalQueries(Integer group,String pointName,int page) {
        IPage<S_C_PointEntity> S_C_PointEntity = new Page<>(page,10);
        QueryWrapper<S_C_PointEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("DISTINCT point_name").eq("group_id",group).eq("point_name",pointName).eq("delete_status","1");
        return getS_c_pointEntities(queryWrapper,S_C_PointEntity);
    }
    public IPage<S_C_PointEntity> conditionalQueries(Integer group,boolean status,int page) {
        IPage<S_C_PointEntity> S_C_PointEntity = new Page<>(page,10);
        QueryWrapper<S_C_PointEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("DISTINCT point_name").eq("group_id",group).eq("delete_status","1");
        return getS_c_pointEntities(queryWrapper,S_C_PointEntity);
    }
    public IPage<S_C_PointEntity> conditionalQueries(String pointName,int page) {
        IPage<S_C_PointEntity> S_C_PointEntity = new Page<>(page,10);
        QueryWrapper<S_C_PointEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("DISTINCT point_name").eq("point_name",pointName).eq("delete_status","1");
        return getS_c_pointEntities(queryWrapper,S_C_PointEntity);

    }

    @NotNull
    private IPage<S_C_PointEntity> getS_c_pointEntities(QueryWrapper<S_C_PointEntity> queryWrapper,IPage<S_C_PointEntity> S_C_PointEntity) {
        IPage<com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.S_C_PointEntity> s_c_pointEntityIPage = s_c_pointMapper.selectPage(S_C_PointEntity, queryWrapper);
        List<com.vq3.digitalizationsoftwareintegrates.Entity.Spot_Check.S_C_PointEntity> records = s_c_pointEntityIPage.getRecords();
        for (S_C_PointEntity sCPointEntity : records) {
            QueryWrapper<S_C_PointEntity> s_c_pointEntityQueryWrapper = new QueryWrapper<>();
            s_c_pointEntityQueryWrapper.eq("point_name",sCPointEntity.getPointName());
            List<S_C_PointEntity> s_c_pointEntities1 = s_c_pointMapper.selectList(s_c_pointEntityQueryWrapper);
            sCPointEntity.setPointCount(s_c_pointEntities1.get(0).getPointCount());
            sCPointEntity.setCreateTime(s_c_pointEntities1.get(0).getCreateTime());
            sCPointEntity.setUpdateTime(s_c_pointEntities1.get(0).getUpdateTime());
            sCPointEntity.setGroupId(s_c_pointEntities1.get(0).getGroupId());
        }
        return s_c_pointEntityIPage;
    }
    //conditionalQueries function rewrite End

    public List<S_C_DatesEntity> findAllPointDailyTODataCenter(int page) throws ParseException {

        int start = ((page -1 ) * 10);
        int size = 10;

        Date tomorrow = GetServerDate.tomorrowInZero(new Date());


        List<S_C_DatesEntity> allPointDailyTODataCenter = s_c_datesMapper.findAllPointDailyTODataCenter(tomorrow,start, size);
        List<S_C_DatesEntity> newAllPointDailyTODataCenter = new ArrayList<>();
        /*for (S_C_DatesEntity s_c_datesEntity : allPointDailyTODataCenter) {
            Date date = s_c_datesEntity.getDate();
            Date date1 = GetServerDate.dateAddMINUTE(date);
            if (date1.before(tomorrow)){

                newAllPointDailyTODataCenter.add(s_c_datesEntity);
            }
        }*/

        for (S_C_DatesEntity s_c_datesEntity : allPointDailyTODataCenter) {
            QueryWrapper<S_C_DatesEntity> s_c_datesEntityQueryWrapper = new QueryWrapper<>();
            s_c_datesEntityQueryWrapper.eq("date",s_c_datesEntity.getDate()).eq("point",s_c_datesEntity.getPoint());

            List<S_C_DatesEntity> s_c_datesEntities = s_c_datesMapper.selectList(s_c_datesEntityQueryWrapper);
            for (S_C_DatesEntity sCDatesEntity : s_c_datesEntities) {

                s_c_datesEntity.setStatusFlag((sCDatesEntity.getPointContentMiddayStatusId() != null && sCDatesEntity.getPointContentMorningStatusId() != null ) && (sCDatesEntity.getPointContentMorningStatusId() == 1 && sCDatesEntity.getPointContentMiddayStatusId() == 1));
            }

        }

        return allPointDailyTODataCenter;
    }

    public int findTotalCurrent() {
        return s_c_datesMapper.findTotalCurrent();

    }

    public List<S_C_StatusEntity> findAllS_CDailyStatus() {
        return s_c_statusMapper.selectList(null);
    }

    public IPage<S_C_DatesEntity> getS_CDataStatus(int page, String pointName, Date date1) {
        IPage<S_C_DatesEntity> s_c_datesEntityIPage = new Page<>(page,10);
        QueryWrapper<S_C_DatesEntity> s_c_datesEntityQueryWrapper = new QueryWrapper<>();
        s_c_datesEntityQueryWrapper.eq("point",pointName).eq("date",date1);
        return s_c_datesMapper.selectPage(s_c_datesEntityIPage,s_c_datesEntityQueryWrapper);
    }

    @Override
    public List<S_C_PointEntity> groupIdFindSCPoint(Integer groupId) {
        QueryWrapper<S_C_PointEntity> s_c_pointEntityQueryWrapper = new QueryWrapper<>();
        s_c_pointEntityQueryWrapper.eq("group_id",groupId);
        return s_c_pointMapper.selectList(s_c_pointEntityQueryWrapper);

    }

    @Override
    public List<MongoDB_S_C_SaveSCDailyContextEntity> findMongoDBSCDaily(String pointName, Date stringToDate) {
        return mongoDB_s_c_saveDailyContextDao.findMongoDBSCDaily(pointName,stringToDate);
    }

    @Override
    public boolean saveS_C_DailyAudit(MongoDB_S_C_SaveSCDailyContextEntity mongoDB_s_c_saveSCDailyContextEntity) {

        List<S_C_DatesEntity> scDatesEntityS = mongoDB_s_c_saveSCDailyContextEntity.getSCDatesEntityS();

        for (S_C_DatesEntity scDatesEntity : scDatesEntityS) {
            System.out.println(scDatesEntity);
            int i = s_c_datesMapper.updateById(scDatesEntity);
            if (!(i > 0)){
                return false;
            }
        }
        return true;


    }

}
